package models

import (
	"github.com/cy77cc/hioshop/global"
	"time"
)

type Footprint struct {
	Model
	UserId  uint `json:"userId" gorm:"type:int unsigned;default:0"`
	GoodsId uint `json:"goodsId" gorm:"type:int unsigned;default:0"`
	AddTime int  `json:"add_time" gorm:"type:int;default:0"`
}

func (f *Footprint) AddFootprint() error {
	f.AddTime = int(time.Now().Unix() / 1000)
	err := global.DB.Model(&Footprint{}).Create(f).Error
	return err
}
